<template>
    <div id="contract_details">
        <div class="body">
            <el-row class="title">
                <div style="margin-bottom: 15px;">
                    <router-link to="/customercare"><el-button  style="float: right;margin-right: 15px;width: 80px;margin-top: 15px;">返回</el-button></router-link>
                    <span style="display: inline-block;font-weight: 800;margin-left: 20px;font-size: 25px;margin-top: 15px;">客户关怀详情</span>
                </div>
            </el-row>

            <!-- 详情 -->
            <el-form label-width="150px" style="overflow:hidden;padding-top:20px" >
                <el-form-item label="关怀记录编号：">
                    {{detailData.careRecId}}
                </el-form-item>
                <el-form-item label="关怀主题：" class="inline__">
                    {{detailData.careTle}}
                </el-form-item>
                <el-form-item label="关怀类型：" class="inline__">
                    {{detailData.careType.careTypeName}}
                </el-form-item>
                <el-form-item label="对应客户：" >
                    {{detailData.customer.customerName}}
                </el-form-item>
                <el-form-item label="执行人：" class="inline__">
                    {{detailData.emp.empName}}
                </el-form-item>
                <el-form-item label="开始时间：" class="inline__">
                    {{detailData.beginTime}}
                </el-form-item>
                <el-form-item label="关怀内容：" class="inline__">
                    {{detailData.careCon}}
                </el-form-item>
                <el-form-item label="客户反馈：" class="inline__">
                    {{detailData.cusBack}}
                </el-form-item>
                <el-form-item label="备注：" class="inline__">
                    {{detailData.remark}}
                </el-form-item>

                <el-form-item label="审核状态：">
                    <span style="margin-right: 50px">{{detailData.check==1?"通过":"未通过"}}</span>
                </el-form-item>

                <template v-if="detailData.check==0">
                    <el-form-item label="审批操作：" class="inline__">
                        <el-button type="primary" @click="checkOne">通过审批</el-button>
                    </el-form-item>
                </template>
            </el-form>
            <br/><br/>
        </div>
    </div>
</template>

<script>

    export default {
        name: "customerCare_detail",
        data() {
            return {
                //详情页面的数据
                detailData: {}
            }
        },
        methods:{
            checkOne(){
                this.$axios.post("api/after-sale/customer-care/cusCareCheck",this.qs.stringify({careId:this.detailData.careRecId}))
                    .then(v=>{
                        this.global.mes_success("审批成功！");
                        this.$router.push({path:"/customerCare"});
                    }).catch();
            }
        },
        created(){
            this.detailData = JSON.parse(sessionStorage.getItem("customerCare"));
            sessionStorage.removeItem("customerCare")
        },
        /* 路由守卫 */
        beforeRouteEnter (to, from, next){
            if (sessionStorage.getItem("customerCare")){
                next()
            }else{
                next({path:"/customercare"})
            }
        }
    }
</script>

<style scoped>
    #contract_details{margin: 0 auto; width: 1000px;}
    .body{background-color: #ffffff;width: 100%;margin-top: 50px;border-radius: 5px}
    .title{border-bottom: 2px solid #ababab;margin:0 10px}
    .inline__{width:50%!important;display:inline-block}
</style>